﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Threading;
using System.Globalization;
using Nivdal.AuxCode;

namespace Nivdal
{
    public partial class SearchNTPlayers : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            OnlineUser ou = (OnlineUser)Session["User"];
            if (ou.NationalTeamCoach == "0")
                Response.Redirect("~/TeamHomePage.aspx");
            if (!IsPostBack)
            {
                PlayersDataSource.SelectParameters.Add("NTTeamId", ou.NationalTeamCoach);
                PlayersDataSource.SelectParameters.Add("Language", ou.Language);

                if (BestPlayersTitleLabel.Text.Length > 100)
                    BestPlayersTitleLabel.Text = BestPlayersTitleLabel.Text.Substring(0, 100) + "...";
            }
        }

        protected override void InitializeCulture()
        {   
            OnlineUser ou = (OnlineUser)Session["User"];
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(ou.UICulture);
            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(ou.Culture);            
        }
    }
}